<#import "base.ftl" as base/>
<#import "spring.ftl" as spring/>

<@base.baseTemplate title="user">
	<@spring.bind "user.*"/>
	<#if spring.status.error>
		<div class="error">
		    <#list spring.status.errorMessages as error>
				${error}<br/>
		    </#list>
		</div>
	</#if>
	<#if saved! == "1">
		<div class="infobox"><@spring.message "successfullysaved"/></div>
	</#if>
	<form name="user" action="" method="post">
		<input type="hidden" name="id" value="${user.id!}">
		
		<div class="line"><label><@spring.message "firstName"/>:</label><input type="text" name="firstName" value="${user.firstName!}" class="text" /></div>
		<div class="line"><label><@spring.message "lastName"/>:</label><input type="text" name="lastName" value="${user.lastName!}" class="text" /></div>
		<div class="line"><label><@spring.message "loginName"/>:</label><input type="text" name="loginName" value="${user.loginName!}" class="text" /></div>
		<div class="line"><label><@spring.message "newpassword"/>:</label><input type="password" name="password1" value="" class="text" /></div>
		<div class="line"><label><@spring.message "newpasswordrepeat"/>:</label><input type="password" name="password2" value="" class="text" /></div>
		<div class="line"><label><@spring.message "enabled"/>:</label>
			<input type="radio" name="enabled" value="yes" <#if user.enabled?string("yes", "no")! == "yes">checked="checked"</#if> /> <@spring.message "yes"/><br />
			<input type="radio" name="enabled" value="no" <#if user.enabled?string("yes", "no")! == "no">checked="checked"</#if> /> <@spring.message "no"/>
		</div>
		<div class="line"><label><@spring.message "role"/>:</label>
			<select name="userRoleId">
				<#list role_list as role>
					<option value="${role.id}" <#if user.userRole.id == role.id>selected="selected"</#if>>${role.name}</option>
				</#list>
			</select>
		</div>
		
		<br/><input type="submit" value="<@spring.message "save"/>" class="submit button" /><a class="button" href="${rc.getContextPath()}/users"><@spring.message "cancel"/></a>
	</form>
</@base.baseTemplate>